package com.example.springbootlearn.annotation;

import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.annotation.Configuration;

/**
 * @author caiji Mr. Li
 * @date 2019/10/16 18:15
 */
@EnableServer(type = Server.Type.FTP)
@Configuration
public class EnableServerBootStrap {
    public static void main(String[] args) {

        //构建Annotation配置驱动Spring上下文
        AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext();
        //注册当前引导类(被@Configuration标注)到Spring的上下文中
        context.register(EnableServerBootStrap.class);
        //启动上下文
        context.refresh();
        //获取名称为“helloWorld”的bean对象
        Server server = context.getBean(Server.class);
        server.start();
        server.stop();
    }

}
